﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/AdminCP/Views/Shared/ViewMasterPage1.Master"
    Inherits="System.Web.Mvc.ViewPage<InfoTech.Mvc.LanTranh.MucVu.Models.GIAODANModel>" %>

<%@ Import Namespace="InfoTech.LanTranh.MucVu.Service" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content-box addGiaoDan">
        <div class="content-box-header">
            <h3>
                Cập nhật Giáo Dân</h3>
        </div>
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <%
                Html.EnableClientValidation(); %>
            <% 
                using (Html.BeginForm())
                {%>
            <%: Html.ValidationSummary() %>
            <%:Html.HiddenFor(c=>c.MAGIAODAN) %>
            <table cellpadding="3" cellspacing="3">
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Giáo Dân
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td colspan="7">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Mã Giáo Dân
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.GIAODANID, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.GIAODANID, "(*)")%>
                        </div>
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                    </td>
                    <td>
                        <span style="font-weight: bold; font-size: 19px; color: brown;">
                            <%=Model.MAGIAODANID%>
                        </span>
                        <%:Html.HiddenFor(c=>c.MAGIAODANID) %>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="7">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Tên Thánh
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.TENTHANH, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.TENTHANH, "(*)")%>
                        </div>
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Không Lưu Sổ
                    </td>
                    <td>
                        <%: Html.CheckBoxFor(c=>c.LUUSO) %>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Đệm
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.HOVATENDEM, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.HOVATENDEM, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Tên
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.TEN, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.TEN, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Ngày Sinh
                    </td>
                    <td colspan="5">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.NGAYSINH,GIAODANService.Get_List_Days(), new { style = "width: 140px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.NGAYSINH, "(*)")%>
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.THANGSINH,GIAODANService.Get_List_Months(), new { style = "width: 145px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.THANGSINH, "(*)")%>
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.NAMSINH,GIAODANService.Get_List_Years(), new { style = "width: 135px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.NAMSINH, "(*)")%>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giới Tính
                    </td>
                    <td valign="middle">
                        <table>
                            <td>
                                <%:Html.RadioButtonFor(c=>c.GIOITINH,"False") %>
                            </td>
                            <td>
                                Nam
                            </td>
                            <td>
                                <%:Html.RadioButtonFor(c=>c.GIOITINH,"True") %>
                            </td>
                            <td>
                                Nữ
                            </td>
                        </table>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Dân Tộc
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DANTOC, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DANTOC, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Địa Chỉ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DIACHI, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DIACHI, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Điện Thoại
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DIENTHOAI, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DIENTHOAI, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Cha
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.HiddenFor(model => model.PARENTID)%>
                            <%: Html.TextBoxFor(model => model.TENCHA, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.PARENTID, "(*)")%>
                            <%: Html.ValidationMessageFor(model => model.TENCHA, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        <img src="<%=Html.AreaImagesPath("AdminCP")%>search.png" style="cursor: pointer"
                            onclick="javascript:TimCha();" />
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Mẹ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.HiddenFor(model => model.MOTHERID)%>
                            <%: Html.TextBoxFor(model => model.TENME, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MOTHERID, "(*)")%>
                            <%: Html.ValidationMessageFor(model => model.TENME, "(*)")%>
                        </div>
                    </td>
                    <td>
                        <img src="<%=Html.AreaImagesPath("AdminCP")%>search.png" style="cursor: pointer"
                            onclick="javascript:TimMe();" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Mục Vụ
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Phận
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAGIAOPHAN,GIAOPHANService.Get_List(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOPHAN, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Hạt
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAGIAOHAT,GIAOHATService.Get_List_Join_GiaoPhan(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOHAT, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Xứ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAGIAOXU,GIAOXUService.Get_List_Join_GiaoPhan_GiaoHat(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOXU, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Họ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAGIAOHO,GIAOHOService.Get_List_Join_GiaoPhan_GiaoHat_GiaoXu(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOHO, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Hành Chính &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Quốc Gia
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAQUOCGIA,QUOCGIAService.Get_List(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAQUOCGIA, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Tỉnh Thành
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MATINHTHANH,TINHTHANHService.Get_List_Join_Country(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MATINHTHANH, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Quận Huyện
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAQUANHUYEN,QUANHUYENService.Get_List_Join_City_Country(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAQUANHUYEN, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Xã Phường
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.DropDownListFor(model => model.MAXAPHUONG,XAPHUONGService.Get_List_Join_City_Country_District(), new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MAXAPHUONG, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                    </td>
                    <td>
                        <input type="submit" value="Cập nhật Giáo Dân" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                    </td>
                </tr>
            </table>
            <% } %>
        </div>
        <!-- End .content-box-content -->
    </div>
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">Đã Cư Ngụ</a></li>
            <li><a href="#tabs-2">Rửa Tội - Rước Lễ - Thêm Sức</a></li>
            <li><a href="#tabs-3">Hôn Nhân</a></li>
            <li><a href="#tabs-4">Tận Hiến</a></li>
            <li><a href="#tabs-5">Xức Dầu</a></li>
            <li><a href="#tabs-6">Tạ Thế</a></li>
            <li><a href="#tabs-7">Báo Cáo</a></li>
        </ul>
        <div id="tabs-1">
        </div>
        <div id="tabs-2">
        </div>
        <div id="tabs-3">
        </div>
        <div id="tabs-4">
        </div>
        <div id="tabs-5">
        </div>
        <div id="tabs-6">
        </div>
        <div id="tabs-7">
        </div>
    </div>
    <script type="text/javascript">
		$(document).ready(function () {
			 $.ajaxSetup ({
// Disable caching of AJAX responses
				cache: false
			});
			$("#tabs").wijtabs({ showOption: {
				blind: true,
				duration: 400
			}, hideOption: {
				blind: true,
				duration: 400
			}, cache: false
			, select: function (event, ui) {
				SelectedTabsChange(ui.index);
			}
			});
			if ("#tabs-1" == self.document.location.hash)
				SelectedTabsChange(0);  
			else if ("#tabs-2" == self.document.location.hash)
				SelectedTabsChange(1);  
			else if ("#tabs-3" == self.document.location.hash)
				SelectedTabsChange(2);           
			else if ("#tabs-4" == self.document.location.hash)
				SelectedTabsChange(3);                       
			else if ("#tabs-5" == self.document.location.hash)
				SelectedTabsChange(4);                       
			else if ("#tabs-6" == self.document.location.hash)
				SelectedTabsChange(5);  
			else if ("#tabs-7" == self.document.location.hash)
				SelectedTabsChange(6);  
			else
				SelectedTabsChange(0);
		});
		 function SelectedTabsChange(id){
			loadingPanel.show();
			if (id == 0){
				$("#tabs-1").load("<%= Url.Action("ViewUserControl_GiaoDan_DaCuNgu","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                                           
					LoadCuNgu();
					loadingPanel.hide();
				});
			}
			else if (id == 2){
				$("#tabs-3").load("<%= Url.Action("ViewUserControl_HonNhan_TanHien","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                             
					Initial();
					loadingPanel.hide();
				});
			}
			else if (id == 3){
				$("#tabs-4").load("<%= Url.Action("ViewUserControl_TanHien","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                                    
					loadingPanel.hide();
				});
			}
			else if (id == 4){  
				$("#tabs-5").load("<%= Url.Action("ViewUserControl_XucDau","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                    
					LoadXucDau();
					loadingPanel.hide();
				});
			}
			else if (id == 5){
				$("#tabs-6").load("<%= Url.Action("ViewUserControl_TaThe","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                                    
					loadingPanel.hide();
				});
			}
			else if (id == 6){
				$("#tabs-7").load("<%= Url.Action("ViewUserControl_GiaoDan_BaoCao","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                    
					loadingPanel.hide();
				});
			}
			else if(id==1){
				$("#tabs-2").load("<%= Url.Action("ViewUserControl_RuaToi_XungToi_ThemSuc","GiaDinhCongGiao",new {id=Model.MAGIAODAN}) %>",function(){                                              
						loadingPanel.hide();                        
					});
			}
			else
				loadingPanel.hide();             
		}
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderCss" runat="server">
    <link href="<%=Html.AreaCssPath("AdminCP") %>themes/wijmo/jquery.ui.wijtabs.css"
        rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">
    <script src="<%=Html.AreaScriptPath("AdminCP") %>wijmo/jquery.ui.wijtabs.js" type="text/javascript"></script>
    <script type="text/javascript" src="<%=Html.AreaScriptPath("AdminCP") %>MucVu.js"></script>
    <script type="text/javascript" src="<%=Html.AreaScriptPath("AdminCP") %>HanhChinh.js"></script>
    <script language="javascript" type="text/javascript">
		$(function () {
			$("#TENTHANH").autocomplete({
					source: function( request, response ) {
							$.ajax({
										url: "<%=Url.Action("DanhSachTenThanh","GiaDinhCongGiao") %>",
										dataType: "json",
										data: {						                      
											q: request.term
										},
										success: function( data ) {
											response( $.map( data, function( item ) {
												return {
													label: item.TENTHANH,
													value: item.TENTHANH
												}
											}));
										}
							});
					},
					minLength: 0,
					select: function( event, ui ) {
						if(ui.item) {                            
							$("#TENTHANH").val(ui.item.value);
						}
					},
					open: function() {
						selecting=true;
						$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
					},
					close: function() {
						$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
						selecting=false;
					}
			});
			$("#DANTOC").autocomplete({
					source: function( request, response ) {
							$.ajax({
										url: "<%=Url.Action("DanhSachDanToc","GiaDinhCongGiao") %>",
										dataType: "json",
										data: {						                      
											q: request.term
										},
										success: function( data ) {
											response( $.map( data, function( item ) {
												return {
													label: item.DANTOC,
													value: item.DANTOC
												}
											}));
										}
							});
					},
					minLength: 0,
					select: function( event, ui ) {
						if(ui.item) {                            
							$("#DANTOC").val(ui.item.value);
						}
					},
					open: function() {
						selecting=true;
						$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
					},
					close: function() {
						$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
						selecting=false;
					}
			});
			$("#MAGIAOPHAN").change(function(){
				Change_GiaoPhan('addGiaoDan','<%=Url.Action("Get_GIAOHAT","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			});     
			$("#MAGIAOHAT").change(function(){
				Change_GiaoHat('addGiaoDan','<%=Url.Action("Get_GIAOXU","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			});
			$("#MAGIAOXU").change(function(){
				Change_GiaoXu('addGiaoDan','<%=Url.Action("Get_GIAOHO","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			}); 
			 $("#MAQUOCGIA").change(function(){
				Change_QuocGia('addGiaoDan','<%=Url.Action("Get_TINHTHANH","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			});     
			$("#MATINHTHANH").change(function(){
				Change_TinhThanh('addGiaoDan','<%=Url.Action("Get_QUANHUYEN","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			});
			$("#MAQUANHUYEN").change(function(){
				Change_QuanHuyen('addGiaoDan','<%=Url.Action("Get_XAPHUONG","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
			});      
		});

		function TimCha()
		{
			Dialog('<%=Url.Action("TimPhuThan","GiaDinhCongGiao") %>','','Tìm Cha',1000,335,HideDialog,ClearData);
		}
		function TimMe()
		{
			Dialog('<%=Url.Action("TimPhuThan","GiaDinhCongGiao",new {id=1}) %>','1','Tìm Mẹ',1000,335,HideDialog,ClearData);
		}

		function Receive(type,id,value)
		{            
			if(type=="1"){
				document.getElementById('TENME').value = value;
				document.getElementById('MOTHERID').value = id;
			}
			else{
				document.getElementById('TENCHA').value = value;
				document.getElementById('PARENTID').value = id;
			}
		}

		function ClearData(type) {
			if(type=="1"){
				document.getElementById('TENME').value = '';
				document.getElementById('MOTHERID').value = '';
			}
			else{
				document.getElementById('TENCHA').value = '';
				document.getElementById('PARENTID').value = '';
			}
		}
	
		function myPopup(url, windowname, w, h, x, y) {
			window.open(url, windowname, "resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width=" + w + ",height=" + h + ",left=" + x + ",top=" + y + "");
		}

    </script>
</asp:Content>
